package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConst;
import com.itheima.entity.Result;
import com.itheima.pojo.Menu;
import com.itheima.service.MenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：daqiang
 * @date ：Created in 2019/12/2
 * @description ：
 * @version: 1.0
 */

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Reference
    MenuService menuService;

    @RequestMapping("/findAll")
    public Result findAll(){
        try {
            List<Menu> menuList = menuService.findAll();
            return new Result(true, MessageConst.QUERY_MENU_SUCCESS,menuList);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(true, MessageConst.QUERY_MENU_FAIL);
        }
    }
}
